/**
 * 定时启动事件
 */
var timerStartEventForm;
function timerStartEventWin_(cell,graph_refresh){
    timerStartEventNodeAttributePanel(cell,graph_refresh);
}

/**
 * @param cell
 * @returns {string|*}
 */
function createTimerStartEventAttributeForm(cell){
    timerStartEventForm =
        "<div class=\"m-portlet\" id='mportletId' style='height:150px;overflow: auto;'>"+
			"<form class=\"m-form m-form--fit m-form--label-align-left m-form--group-seperator-dashed\" id=\"defaultForm\" method=\"post\">"+
				"<div class=\"m-portlet__body\">"+

					//持续时间
					"<div class=\"form-group row\">"+
						"<div class=\"col-md-1\">"+
							"<label class=\"col-form-label\" >持续时间</label>"+
						"</div>"+
						"<div class=\"col-md-4\">"+
							"<input class=\"form-control\" type=\"text\" maxlength=\"50\"   onchange='setInputValue(this,\"TimerStartEvent\")' data-bv-notempty data-bv-notempty-message=\"请输入持续时间\" id=\"timeDuration\" name=\"timeDuration\" placeholder=\"请输入持续时间\">"+
						"</div>"+
					"</div>"+

					//时间日期
					"<div class=\"form-group row\">"+
						"<div class=\"col-md-1\">"+
							"<label class=\"col-form-label\" >时间日期</label>"+
						"</div>"+
						"<div class=\"col-md-4\">"+
							"<input class=\"form-control\" type=\"text\" id=\"timeDate\" onchange='setInputValue(this,\"TimerStartEvent\")' name=\"timeDate\" placeholder=\"请输入时间日期\">"+
						"</div>"+
					"</div>"+

					//时间转换
					"<div class=\"form-group row\">"+
						"<div class=\"col-md-1\">"+
							"<label class=\"col-form-label\" >时间转换</label>"+
						"</div>"+
						"<div class=\"col-md-4\">"+
							"<input class=\"form-control\" type=\"text\" maxlength=\"50\" onchange='setInputValue(this,\"TimerStartEvent\")' id=\"timeCycle\" name=\"timeCycle\" placeholder=\"时间转换\">"+
						"</div>"+
					"</div>"+

				"</div>"+
			"</form>"+
        "</div>";
    return timerStartEventForm;
}

/**
 *
 */
function initTimerBoundaryEventData(cell){
    var timeDuration = cell.timeDuration;
    var timeDate = cell.timeDate;
    var timeCycle = cell.timeCycle;
    $('#timeDuration').val(timeDuration);
    $('#timeDate').val(timeDate);
    $('#timeCycle').val(timeCycle);
}


/**
 *
 * @param cell
 * @param graph_refresh
 */
function timerStartEventNodeAttributePanel(cell,graph_refresh){
    timerStartEventForm = createTimerStartEventAttributeForm(cell);
    nodeNormalForm = createNodeNormalForm(cell,1,"TimerStartEvent");
    form_grid = creatFormGrid(cell);
    event_grid = creatEventGrid(cell,1);
    //Tab Index
    var Tab =
        "<div class='col-md-1' id='TabCol'>"+
			"<div class=\"nav flex-column nav-tabs nav-tabs-vertical mb-4 mb-xl-0\">"+
				"<a href=\"#v-pills-home2\" data-toggle=\"pill\" class=\"active show\">一般配置</a>"+

				"<a href=\"#v-pills-profile2\" data-toggle=\"pill\" class=\"\">基本属性</a>"+

                "<a href=\"#v-pills-messages3\" data-toggle=\"pill\" class=\"\">表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单</a>"+

				"<a href=\"#v-pills-messages4\" data-toggle=\"pill\" class=\"\">监听事件</a>"+

				// "<a href='javascript:setTimerStartEventValue()' class='svBtn'>保存配置</a>"+
			"</div>"+
        "</div>"+

        "<div class='col-md-11'>"+
			"<div class=\"tab-content tab-content-default\">"+
				"<div class=\"tab-pane fade active show\" id=\"v-pills-home2\">"+nodeNormalForm+"</div>"+
				"<div class=\"tab-pane fade\" id=\"v-pills-profile2\">"+timerStartEventForm+"</div>"+
                "<div class=\"tab-pane fade\" id=\"v-pills-messages3\">"+form_grid+"</div>"+
				"<div class=\"tab-pane fade\" id=\"v-pills-messages4\">"+event_grid+"</div>"+
			"</div>"+
        "</div>";
    var formInfo = "<div class='card-body'><div class='row' style='height:200px;overflow: auto;'>"+ Tab+ "</div></div>"
    $("#geSetContainer").empty();
    $("#geSetContainer").append(cExpansion);//收缩/展开
    $("#geSetContainer").append(formInfo);
    initSZ();

    //基本属性
    initTimerStartEventData(cell);
    //一般属性 参数1表示非开始2其他
    initNodeNormalForm(cell,1);
    //表单配置信息
    initform_grid(cell);
    //共用taskGrid属性事件
    initevent_grid(cell,1);
    nodeScroll();
}

/**
 *
 */
function initTimerStartEventData(cell){
    var timeDuration = cell.timeDuration;
    var timeDate = cell.timeDate;
    var timeCycle = cell.timeCycle;
    $('#timeDuration').val(timeDuration);
    $('#timeDate').val(timeDate);
    $('#timeCycle').val(timeCycle);
}

/**
 * 设置内容
 */
function setTimerStartEventValue(){
    //var attachedToRef = $('#attachedToRef').val();
    var timeDuration = $('#timeDuration').val();
    var timeDate = $('#timeDate').val();
    var timeCycle = $('#timeCycle').val();
    var graph = new mxGraph();
    graph.getModel().beginUpdate();
    try
    {
        //1通用基本属性并具有赋值功能
        if(node_normal_setvalue(JehcClickCell,1)== false){
            return;
        }
        //2事件配置
        if(event_setvalue(JehcClickCell)== false){
            return;
        }
        //3基本属性
        /**
         if(null != attachedToRef && "" != attachedToRef){
			cell.attachedToRef = attachedToRef;
		}
         **/
        // if(null != timeDuration && "" != timeDuration){
            JehcClickCell.timeDuration = timeDuration;
        // }
        // if(null != timeDate && "" != timeDate){
            JehcClickCell.timeDate = timeDate;
        // }
        // if(null != timeCycle && "" != timeCycle){
            JehcClickCell.timeCycle = timeCycle;
        // }
        //4配置表单事件
        if(event_form_setvalue(JehcClickCell) == false){
            return;
        }
        graph.startEditing();
    }
    finally
    {
        graph.getModel().endUpdate();
        graph_refresh.refresh();
    }
}